<template>
  <div class="banner-header-container">
    <div class="header-text">
      <div class="right">
        <div class="operate">
          <i class="iconfont iconscreen-full2" @click="open"></i>
        </div>
        <div class="unit" v-show="unit">{{ unit }}</div>
        <div class="bar" v-show="isCheck"></div>
        <div class="check" v-show="isCheck">
          <div
            class="lable-1"
            :class="{ 'lable-1__active': item.id === check }"
            v-for="item in checkList"
            :key="item.id"
            @click="select(item)"
          >
            {{ item.title }}
          </div>
        </div>
      </div>
      <div class="left">
        <div class="lable-2">{{ title2 }}</div>
        <div class="lable-1">{{ title1 }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      checkList: [
        {
          title: "年度",
          id: "1",
        },
        {
          title: "累计",
          id: "2",
        },
      ],
      check: "1",
    };
  },
  props: {
    title1: {
      default: "开票与收款",
      type: String,
    },
    title2: {
      default: "Invoicing & Collection",
      type: String,
    },
    isCheck: {
      default: true,
      type: Boolean,
    },
    unit: {
      default: "",
      type: String,
    },
  },
  methods: {
    select(msg) {
      this.check = msg.id;
      this.$emit("select", msg.id);
    },
    open() {
      this.$emit("open");
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/views/report_form_dark/styles/fn.scss";
@import "~@/assets/dark/font/iconfont.css";

.banner-header-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid rgba(83, 237, 255, 0.2);

  .header-text {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;

    .left {
      height: 100%;
      display: flex;
      flex-direction: row;
      align-items: center;

      .lable-1 {
        height: 100%;
        font-size: vw(16);
        font-family: Microsoft YaHei UI;
        font-weight: bold;
        color: #53edff;
        display: flex;
        flex-direction: row;
        align-items: center;
        position: relative;

        &::before {
          content: "";
          display: block;
          position: absolute;
          bottom: vh(-1);
          right: 0;
          width: vw(32);
          height: vh(2);
          background: #53edff;
        }
      }

      .lable-2 {
        font-size: vw(14);
        font-family: Calibri;
        font-weight: 400;
        line-height: vh(17);
        color: #53edff;
        opacity: 0.4;
        margin-right: vw(8);
      }
    }

    .right {
      height: 100%;
      display: flex;
      flex-direction: row;
      align-items: center;

      .unit {
        font-size: vw(14);
        font-family: Microsoft YaHei UI;
        font-weight: 400;
        color: #8fc7ff;
        opacity: 0.4;
        margin: 0 vw(10);
      }

      .check {
        height: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;

        .lable-1 {
          height: 100%;
          display: flex;
          flex-direction: row;
          align-items: center;
          font-size: vw(14);
          font-family: Microsoft YaHei UI;
          font-weight: 400;
          line-height: vh(18);
          color: rgba(83, 237, 255, 0.24);
          margin: 0 vw(6);
          cursor: pointer;

          &__active {
            color: #53edff;
            position: relative;

            &::before {
              content: "";
              width: 8px;
              height: 2px;
              background: #53edff;
              display: block;
              position: absolute;
              bottom: vh(-1);
              left: 50%;
              transform: translateX(-50%);
            }
          }
        }
      }

      .bar {
        width: 0;
        height: vh(16);
        border: 1px solid #8fc7ff;
        opacity: 0.16;
        margin: 0 vw(10);
      }

      .operate {
        margin-left: vw(6);
        width: vw(16);
        height: vw(16);

        i {
          font-size: vw(16);
          color: rgba(143, 199, 255, 0.2);
          cursor: pointer;
        }
      }
    }
  }
}
</style>